<?php
class Main extends CI_Controller {

	public function __construct() {
		parent::__construct();
		if (! $this->usersession->userLoggedIn()) {
			redirect("login/index/", "refresh");
		}
	}

	function index() {

		$aData = array();

		$time_start = microtime(true);

		$aData['user'] = $this->usersession->currentUser();
		/*
		$data['extCity'] = $this->model_data->bringExt('city');
		$data['extCounty'] = $this->model_data->bringExt('county');
		$data['extDomain'] = $this->model_data->bringExt('domain');
		$data['extSubDomain'] = $this->model_data->bringExt('domain', 1);
		$data['extPosition'] = $this->model_data->bringExt('position');
		$data['extSubPosition'] = $this->model_data->bringExt('position', 1);
		$data['extClient'] = $this->model_data->bringExt('client');
		$data['extDivision'] = $this->model_data->bringExt('division');

		$data['extUser'] = $this->model_data->bringUser();
		$data['extLetters'] = $this->model_data->bringLetters();

		$data['extAge'] = $this->model_data->bringExtCustom('age');
		$data['extUnsubscribed'] = $this->model_data->bringExtCustom('unsubscribed');
		$data['extIncome'] = $this->model_data->bringExtCustom('income');
		$data['extEmployee'] = $this->model_data->bringExtCustom('employee');
		$data['extAvailable'] = $this->model_data->bringExtCustom('available');
		$data['extPriority'] = $this->model_data->bringExtCustom('priority');
		$data['extSex'] = $this->model_data->bringExtCustom('sex');
	   // $data['extTurnover'] = $this->model_data->bringExtCustom('turnover');

		$time_end = microtime(true);
		$time = $time_end - $time_start;
		//echo "It took $time seconds\n";*/
		//print_r($this->usersession->currentUser());
		$this->load->view('main', $aData);
	}

	function do_logout() {
		$this->usersession->logoutUser();
		header("Location: ".$this->config->item('base_url')."login");
	}

}

